package com.luych.toolbox.common.service;

import com.luych.toolbox.common.constant.AnnotationConstant;
import com.luych.toolbox.common.service.configuration.AuthenticationConfiguration;
import com.luych.toolbox.common.service.configuration.ExceptionConfiguration;
import com.luych.toolbox.common.service.configuration.SwaggerConfiguration;
import com.luych.toolbox.common.service.configuration.WebSockerConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cloud.bus.jackson.RemoteApplicationEventScan;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Import;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;
import springfox.documentation.oas.annotations.EnableOpenApi;

import java.lang.annotation.*;

@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Inherited
@EnableOpenApi
@SpringBootApplication
@EnableDiscoveryClient
@EnableCircuitBreaker
@EnableWebSecurity
@EnableJpaAuditing
@EnableRedisHttpSession
@EnableCaching
@EnableAsync
@EnableGlobalMethodSecurity(prePostEnabled = true)
@EnableFeignClients(basePackages = AnnotationConstant.FEIGN_PACKAGE)
@RemoteApplicationEventScan(basePackages = AnnotationConstant.EVENT_PACKAGE)
@Import({
        SwaggerConfiguration.class,
        AuthenticationConfiguration.class,
        WebSockerConfiguration.class,
        ExceptionConfiguration.class
})
public @interface SpringCloudServiceApplication {
}
